package main.java.task;

public class TimePrintTask implements Runnable {

    @Override
    public void run() {
        while (true) {
            try {
                // 每秒输出一次当前时间
                System.out.println("当前时间：" + new java.util.Date());
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                Thread.currentThread().interrupt();
                break;
            }
        }
    }
}